package com.tywj.lib.storage.mmkv

interface IStorage {
    fun put(key: String, value: Boolean): Boolean

    fun put(key: String, value: ByteArray): Boolean

    fun put(key: String, value: Double): Boolean

    fun put(key: String, value: Float): Boolean

    fun put(key: String, value: Int): Boolean

    fun put(key: String, value: Long): Boolean

    fun put(key: String, value: Set<String>): Boolean

    fun put(key: String, value: String): Boolean

    fun getBoolean(key: String, defValue: Boolean = false): Boolean

    /**
     * 如果该key不存在，返回一个size为0的ByteArray
     */
    fun getByteArray(key: String): ByteArray

    fun getDouble(key: String, defValue: Double = 0.0): Double

    fun getFloat(key: String, defValue: Float = 0.0f): Float

    fun getInt(key: String, defValue: Int = 0): Int

    fun getLong(key: String, defValue: Long = 0L): Long

    fun getStringSet(key: String): Set<String>?

    fun getString(key: String): String?

    fun remove(key: String)

    fun clear()

    fun contains(key: String): Boolean

    fun allKeys(): Array<String>
}